<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script type="text/javascript">
		$.extend($.fn.validatebox.defaults.rules, {    
		    minLength: {    
		        validator: function(value, param){    
		            return value.length >= param[0];    
		        },    
		        message: '字数不得少于 {0} 字！'   
		    }    
		}); 
	</script>
	<script type="text/javascript">
		$(function() {
			$.post("getEmpInfo",function(info){
				$("#loan_form").form("load",info);
			});
			$("#loanMoney").numberspinner({
				onChange:function(newValue, oldValue){
					$("#loanBigmoney").textbox("setValue",convertCurrency(newValue));
					$("#loanBigmoney").textbox("setText",convertCurrency(newValue));
				}
			});
			$("#loan_submit").linkbutton({
				onClick : function() {
					$("#loan_form").form({
						url : "submit_loan",
						onSubmit : function(params) {
							params.pk = 'loan_act';
						},
						success : function(data) {
							if (data) {
								$("#loan_form").form("clear");
								var tab = $('#tt').tabs('getSelected');
								var index = $('#tt').tabs('getTabIndex',tab);
								if(index != 0){
									$('#tt').tabs('close',index);
								}
							}
							$.messager.alert("消息",data ? "提交成功！" : "提交失败！");
						}
					});
					var submit = $("#loan_form").form('enableValidation').form('validate');
					if (submit) {
						$.messager.confirm('消息', '您确定上传该流程吗？上传后无法修改！', function(r){
							if (r) {
								$("#loan_form").submit();
							}
						})
					}
				}
			});
			$("#loan_save").linkbutton({
				onClick : function() {
					$("#loan_form").form({
						url : "save_loan",
						success : function(data) {
							if (data) {
								//获取选中的面板
								var tab = $('#tt').tabs('getSelected');
								//根据选中的面板获取该面板的索引
								var index = $('#tt').tabs('getTabIndex',tab);
								//根据索引关闭
								if(index != 0){
									$("#loan_form").form("clear");
									$('#tt').tabs('close',index);
								}
							}
							$.messager.alert("消息",data ? "保存成功！" : "保存失败！");
						}
					});
					var submit = $("#loan_form").form('enableValidation').form('validate');
					if (submit) {
						$.messager.confirm('消息', '您确定上传该流程吗？上传后无法修改！', function(r){
							if (r) {
								$("#loan_form").submit();
							}
						})
					}
				}
			});
		})
	</script>
	<div class="easyui-layout" fit="true" >
		<div data-options="region:'center'" align="center" style="border: none;">
			<form id="loan_form" method="post">
				<table class="table " style="margin: 10px; width: 70%" border="0"
					cellpadding="0" cellspacing="0">
					<thead>
						<tr align="center">
							<th colspan="5" style="font-size: 17px">借款申请单</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>
								<!-- 借款人id -->
								<input name="empId" type="hidden">
								<!-- 借款申请人名称 -->
								<input name="loanName" class="easyui-textbox" style="width: 30%"
									data-options="readonly:'true',label:'姓名：',labelAlign:'right'">
								<!--  借款申请时间 -->
								<input name="loanUptime" class="easyui-datebox"
									labelAlign='right' style="width: 30%;" label="申请日期："
									readonly="true">
								<!-- 借款申请人部门  -->
								<input name="deptId" type="hidden">
								<input name="loanDept" class="easyui-textbox" readonly="true"
									labelAlign='right' style="width: 30%;" label="部门：" ></input>
							</td>
						</tr>
						<tr>
							<td>  
								<!-- 个人借款余额  -->
								<input name="empLoanbalance" class="easyui-textbox" labelAlign='right'
									style="width: 30%" label="借款余额：" readonly="true">
								<!-- 借款金额  -->
								<input id="loanMoney" name="loanMoney" labelAlign='right' class="easyui-numberspinner"
								data-options="required:true,precision:1,groupSeparator:',',decimalSeparator:'.',prefix:'￥'"
									style="width: 30%" label="借款金额：" validType="length[0,12]">
								<!-- 大写金额  -->
								<input id="loanBigmoney" name="loanBigmoney" labelAlign='right' class="easyui-textbox"
									style="width: 30%;" label="大写金额：" readonly="true">
							</td>
						</tr>
						<tr>
							<td>
								<!-- 借款说明  -->
								<input name="loanExplain" class="easyui-textbox" style="width: 80%"
									data-options="validType:'minLength[50]',label:'借款说明（不少于50字）：',labelAlign:'right',
									labelWidth:'160px',required:true,multiline : true,height:'100px'">
							</td>
						</tr>
						<tr>
							<td style="text-align: center;">
								<a id="loan_save" class="easyui-linkbutton"
									data-options="iconCls:'icon-save',text:'暂存'"></a>
								<a id="loan_submit" class="easyui-linkbutton"
									data-options="iconCls:'icon-submit',text:'提交'"></a>
							</td>
						</tr>
					</tbody>

				</table>
			</form>
		</div>
		<!-- <div class="employs_form" data-options="region:'east',title:''"
			style="width: 300px"></div> -->
	</div>
</body>
</html>